package com.liuyk.commonlib.router.intercept;

import android.util.Log;
import android.widget.Toast;

import com.alibaba.android.arouter.facade.Postcard;
import com.alibaba.android.arouter.facade.callback.NavigationCallback;
import com.liuyk.commonlib.App;

/**
 * 单独降级策略（跳转失败的处理）和拦截器都会走这里
 * <p>
 * Created by liuyk on 2019/4/25.
 */
public class CustomNavigationCallback implements NavigationCallback {
    private static final String TAG = "ARouter";

    @Override
    public void onFound(Postcard postcard) {
        //成功找到
        Log.w(TAG, "onFound");
    }

    @Override
    public void onLost(Postcard postcard) {
        //丢失
        Log.w(TAG, "onLost");
    }

    @Override
    public void onArrival(Postcard postcard) {
        //跳转成功
        Log.w(TAG, "onArrival");
    }

    @Override
    public void onInterrupt(Postcard postcard) {
        //被拦截
        Log.w(TAG, "onInterrupt");
    }

    private void showToast(String s) {
        Toast.makeText(App.context, s, Toast.LENGTH_LONG).show();
    }
}
